#include<bits/stdc++.h>
#define ll long long
#define endl '\n'
#define en cout<<endl;
#define f first
#define s second
#define bg begin()
#define e end()
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define pb push_back
#define mp make_pair
#define forn for(int i=0;i<n;i++)
#define form for(int i=0;i<m;i++)
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
const ll MOD=1e9+7;
bool isPrime(ll n){
if(n<=1)return 0;
int f=0;
for(int i=1;i<=sqrt(n)&&f<=2;i++){
if(n%i==0)f++;
}
return f<2;
}
void solve(){
int n,ntz=0;
cin>>n;
int arr[n];
forn{
cin>>arr[i];
ntz+=(arr[i]!=0);
}
vector<pair<int,int>>v;
int l=0;bool have=0;
for(int i=0;i<n;i++){
if(arr[i]!=0)have=1;
if(have&&(i==n-1||arr[i+1]!=0)){
v.push_back({l+1,i+1});
l=i+1;
have=0;
}
}
if(v.size()){
cout<<"YES";en
cout<<v.size();en
for(int i=0;i<v.size();i++)cout<<v[i].f<<" "<<v[i].s<<"\n";
return;
}
cout<<"NO";
}
int main(){
// fast;
int t = 1;
// cin>>t;
for (int i = 1; i <= t; ++i){
//cout<<"Case "<<i<<": ";
solve();
if (i != t) cout<<'\n';
}
}
/*
cout<<INT_MAX<<LLONG_MIN;
*/
1092B - Teams Forming | 1166C - A Tale of Two Lands |
544B - Sea and Islands | 152B - Steps |
1174D - Ehab and the Expected XOR Problem | 1511A - Review Site |
1316A - Grade Allocation | 838A - Binary Blocks |
1515D - Phoenix and Socks | 1624D - Palindromes Coloring |
1552F - Telepanting | 1692G - 2Sort |
1191A - Tokitsukaze and Enhancement | 903A - Hungry Student Problem |
52B - Right Triangles | 1712A - Wonderful Permutation |
1712D - Empty Graph | 1712B - Woeful Permutation |
1712C - Sort Zero | 1028B - Unnatural Conditions |
735B - Urbanization | 746C - Tram |
1278B - A and B | 1353D - Constructing the Array |
1269C - Long Beautiful Integer | 1076A - Minimizing the String |
913C - Party Lemonade | 1313A - Fast Food Restaurant |
681A - A Good Contest | 1585F - Non-equal Neighbours |